package com.powergisol.gis.util;

import java.text.SimpleDateFormat;
import java.util.Date;

public class DateUtils {

    /**
     * 将时间转换为字符串
     * @param date 时间
     * @param  pattern 格式化样式
     * @return
     */
    public static String dateToString(Date date,String pattern) {

        SimpleDateFormat simpleDateFormat = new SimpleDateFormat(pattern);

        String pstrString = simpleDateFormat.format(date);

        return pstrString;
    }

    public static void main(String[] args) {
        System.out.println(dateToString(new Date(),"yyyyMMddHHmmss"));
    }
}
